﻿//***********************************************************************************//
// Autor:  			Adrian Di Puglia      						     				*//
//***********************************************************************************//
//  Compara contraseñas y correos de confirmación, Checkea Terminos y condiciones   *//
// _________________________________________________________________________________*//
function justNumbers(e) {
    var keynum = window.event ? window.event.keyCode : e.which;
    if ((keynum == 8))
        return true;

    return /\d/.test(String.fromCharCode(keynum));
}

function checker(that) {
    if (that.checked) {
        toggle.style.display = "";
        msg.style.color = "black";
        boton.removeAttribute("disabled");
    } else {
        toggle.style.display = "none";
        msg.style.color = "red";
        boton.disabled = "disabled";
    }
}

function upperCase(e) {
    $("#User_I_name").keyup(function () {
        $(this).val($(this).val().toUpperCase());
    });

    $("#User_I_last_name").keyup(function () {
        $(this).val($(this).val().toUpperCase());
    });
}

function checkPass() {
    var pass1 = document.getElementById('RegisterModel_Password');
    var pass2 = document.getElementById('RegisterModel_ConfirmPassword');
    var message = document.getElementById('confirmMessagePass');
    
    //Set the colors we will be using ...
    var goodColor = "#ffffff";
    var badColor = "#ffeeee";

    if (pass1.value == pass2.value) {
        pass2.style.backgroundColor = goodColor;
        message.style.color = goodColor;
        message.innerHTML = "Contraseñas Coinciden!"
    } else {
        pass2.style.backgroundColor = badColor;
        message.style.color = "#ff6666";
        message.innerHTML = "Contraseñas NO Coinciden!"
    }
}

function checkMail() {
    var mail1 = document.getElementById('RegisterModel_Email');
    var mail2 = document.getElementById('RegisterModel_c_Email');
    var message = document.getElementById('confirmMessageMail');
    //Set the colors we will be using ...
    var goodColor = "#ffffff";
    var badColor = "#ffeeee";

    if (mail1.value == mail2.value) {
        mail2.style.backgroundColor = goodColor;
        message.style.color = goodColor;
        message.innerHTML = "Correos Coinciden!"
    } else {
        mail2.style.backgroundColor = badColor;
        message.style.color = "#ff6666";
        message.innerHTML = "Correos NO Coinciden!"
    }
}


$(document).ready(function(){
    $('input[type="radio"]').click(function(){
        if($(this).attr("value")=="Si"){
            $("#show_hide_recomendado").show();
        }
        if($(this).attr("value")=="No"){
            $("#show_hide_recomendado").hide();
        }
    });

    $('#reg_form').submit(function () {
        if ($("#r_si").attr("checked") == true && $('#User_I_recomendado').val() == '') {
            alert('Debe colocar el Nombre del Alumno que lo Recomendo a usted');
            return false;
        }
    });
});